home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / projectViewer.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.6 KB  |  207 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  December 9, 1996
  22. //  Author:         DSW
  23. //
  24. //  Description:
  25. //      Project Viewer.
  26. //        Performs standard file operations such as Open, Save, Import, etc.
  27. //
  28. //  Input Arguments:
  29. //      String      The action requested.
  30. //                    Open, Import, Reference, SaveAs, 
  31. //                    ExportAll, ExportActive
  32. // 
  33. //  Return Value:
  34. //        None.
  35. //
  36.  
  37. //
  38. //    Globals used by the browser.
  39. //
  40. global string $gv_operationMode;
  41. global string $gFileOptionsString;
  42.  
  43.  
  44. // Callback procs.
  45. //
  46.  
  47. // pv_performAction moved to its own mel file.
  48.  
  49. proc string[] pv_ActionSetup ( string $newAction )
  50. //
  51. //    Description:
  52. //        This proc sets up the viewer to perform the action specified when the
  53. //      action button is pressed by the user.
  54. //
  55. {
  56.     global string $gv_operationMode;
  57.     
  58.     string $saveType;
  59.     string $readType;
  60.     string $type[3];
  61.     string $workspace = `workspace -fn`;
  62.     
  63.     $gv_operationMode = $newAction;
  64.     
  65.     // No option was set for the save type.
  66.     $saveType = "mayaBinary";
  67.     
  68.     // No option was set for the save type.
  69.     $readType = "Best Guess";
  70.  
  71.     switch ($newAction) {
  72.       case "Open": {
  73.         if (`optionVar -exists defaultFileOpenType`) {
  74.             $readType = `optionVar -q defaultFileOpenType`;
  75.         }
  76.         $type[0] = "Open";
  77.         $type[1] = $readType;
  78.         $type[2] = "0";
  79.         setWorkingDirectory $workspace $readType "scene";
  80.         break;
  81.       }
  82.       case "Reference": {
  83.         if (`optionVar -exists defaultFileReferenceType`) {
  84.             $readType = `optionVar -q defaultFileReferenceType`;
  85.         }
  86.         $type[0] = "Reference";
  87.         $type[1] = $readType;
  88.         $type[2] = "0";
  89.         setWorkingDirectory $workspace $readType "scene";
  90.         break;
  91.       }
  92.       case "Import": {
  93.         if (`optionVar -exists defaultFileImportType`) {
  94.             $readType = `optionVar -q defaultFileImportType`;
  95.         }
  96.         $type[0] = "Import";
  97.         $type[1] = $readType;
  98.         $type[2] = "0";
  99.         setWorkingDirectory $workspace $readType "scene";
  100.         break;
  101.       }
  102.       case "ReplaceReference": {
  103.         if (`optionVar -exists defaultFileReferenceType`) {
  104.             $readType = `optionVar -q defaultFileReferenceType`;
  105.         }
  106.         $type[0] = "Reference";
  107.         $type[1] = $readType;
  108.         $type[2] = "0";
  109.         setWorkingDirectory $workspace $readType "scene";
  110.         break;
  111.       }
  112.       case "Save": 
  113.       {
  114.         $gv_operationMode = "SaveAs";
  115.         if (`optionVar -exists defaultFileSaveType`) 
  116.         {
  117.             $saveType = `optionVar -q defaultFileSaveType`;
  118.         }
  119.         string $objectTypes[] = `workspace -q -ot`;
  120.         int $index;
  121.         int $mode = 1;
  122.         int $numObjectTypes = size($objectTypes);
  123.         for ($index = 0; $index < $numObjectTypes; $index+=2) 
  124.         {
  125.             if ($objectTypes[$index] == "scene") 
  126.             {
  127.                 $mode = 2;
  128.             }
  129.         }
  130.         $type[0] = "Save";
  131.         $type[1] = $saveType;
  132.         $type[2] = $mode;
  133.         setWorkingDirectory $workspace $saveType "scene";
  134.         break;
  135.       }
  136.       case "SaveAs": 
  137.       {
  138.             if (`optionVar -exists defaultFileSaveType`) 
  139.             {
  140.                 $saveType = `optionVar -q defaultFileSaveType`;
  141.             }
  142.             string $objectTypes[] = `workspace -q -ot`;
  143.             int $index;
  144.             int $mode = 1;
  145.             int $numObjectTypes = size($objectTypes);
  146.             for ($index = 0; $index < $numObjectTypes; $index+=2) 
  147.             {
  148.                 if ($objectTypes[$index] == "scene") 
  149.                 {
  150.                     $mode = 2;
  151.                 }
  152.             }
  153.             $type[0] = "Save As";
  154.             $type[1] = $saveType;
  155.             $type[2] = $mode;
  156.             setWorkingDirectory $workspace $saveType "scene";
  157.         break;
  158.       }
  159.       case "ExportAll": {
  160.         if (`optionVar -exists defaultFileExportAllType`) {
  161.             $saveType = `optionVar -q defaultFileExportAllType`;
  162.         }
  163.         $type[0] = "Export All";
  164.         $type[1] = $saveType;
  165.         $type[2] = "1";
  166.         setWorkingDirectory $workspace $saveType "scene";
  167.         break;
  168.       }
  169.       case "ExportActive": {
  170.         if (`optionVar -exists defaultFileExportActiveType`) {
  171.             $saveType = `optionVar -q defaultFileExportActiveType`;
  172.         }
  173.         $type[0] = "Export Selection";
  174.         $type[1] = $saveType;
  175.         $type[2] = "1";
  176.         setWorkingDirectory $workspace $saveType "scene";
  177.         break;
  178.       }
  179.       case "CreateReference": {
  180.         if (`optionVar -exists defaultFileCreateReferenceType`) {
  181.             $saveType = `optionVar -q defaultFileCreateReferenceType`;
  182.         }
  183.         $type[0] = "Reference";
  184.         $type[1] = $saveType;
  185.         $type[2] = "0";
  186.         setWorkingDirectory $workspace $saveType "scene";
  187.         break;
  188.       }
  189.     }
  190.  
  191.     return $type;
  192. }
  193.  
  194. global proc int projectViewer ( string $startUpAction )
  195. //
  196. //    Description:
  197. //        This is the main procedure for the projectViewer.
  198. //
  199. {
  200.     string $typeAndMode[3];
  201.     
  202.     $typeAndMode = `pv_ActionSetup $startUpAction`;
  203.     fileBrowser "pv_performAction" $typeAndMode[0] $typeAndMode[1] ((int)$typeAndMode[2]);
  204.     
  205.     return 1;
  206. }
  207.